package com.sinosoft.dsp.platform.components.portal.iteration;

import org.primefaces.json.JSONException;
import org.primefaces.json.JSONObject;

import com.sinosoft.dsp.system.core.log.Log;

public class IterationObject implements IDataTableObject {

	private static final long serialVersionUID = -8601859219010162130L;

	private static final Log log = Log.getLog(IterationObject.class.getName());

	private String id;

	private Boolean valid;

	private Boolean check;

	private String type;

	@Override
	public String getId() {
		return id;
	}

	@Override
	public void setId(String id) {
		this.id = id;
	}

	@Override
	public Boolean isValid() {
		if (valid == null) {
			valid = true;
		}
		return valid;
	}

	@Override
	public void setValid(Boolean valid) {
		this.valid = valid;
	}

	@Override
	public Boolean isCheck() {
		if (check == null) {
			check = false;
		}
		return check;
	}

	@Override
	public void setCheck(Boolean check) {
		this.check = check;
	}

	@Override
	public String getData() {
		JSONObject json = new JSONObject();
		try {
			json.put("id", this.id);
		} catch (JSONException e) {
			log.error("树形获得数据出现错误");
		}

		return json.toString();
	}

	@Override
	public String getType() {
		return type;
	}

	@Override
	public void setType(String type) {
		this.type = type;
	}
}
